﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.aswingui {
    import org.aswing.*;
    import org.aswing.geom.*;
    import org.aswing.ext.*;

    public class GridListHorizontalLayout extends GridListLayout {

        public function GridListHorizontalLayout(_arg1:int=1, _arg2:int=1, _arg3:int=2, _arg4:int=2){
            super(_arg1, _arg2, _arg3, _arg4);
            if ((((_arg1 == 0)) || ((_arg2 == 0)))){
                throw (new ArgumentError("neither rows nor columns can be zero"));
            };
        }
        override public function preferredLayoutSize(_arg1:Container):IntDimension{
            var _local2:int = getColumns();
            var _local3:int = getRows();
            var _local4:int = getHgap();
            var _local5:int = getVgap();
            if ((((_local2 == 0)) || ((_local3 == 0)))){
                throw (new Error("neither rows nor columns can be zero"));
            };
            var _local6:Insets = _arg1.getInsets();
            var _local7:int = _arg1.getComponentCount();
            var _local8:int = Math.ceil((_local7 / (_local3 * _local2)));
            var _local9:int = getTileWidth();
            var _local10:int = getTileHeight();
            var _local11:int = (((_local6.left + _local6.right) + ((_local8 * _local2) * _local9)) + (((_local8 * _local2) - 1) * _local4));
            var _local12:int = (((_local6.top + _local6.bottom) + (_local3 * _local10)) + ((_local3 - 1) * _local5));
            return (new IntDimension(_local11, _local12));
        }
        override public function getViewSize(_arg1:GridCellHolder):IntDimension{
            return (this.preferredLayoutSize(_arg1));
        }
        override public function layoutContainer(_arg1:Container):void{
            var _local15:int;
            var _local16:int;
            var _local17:int;
            var _local2:int = getColumns();
            var _local3:int = getRows();
            var _local4:int = getHgap();
            var _local5:int = getVgap();
            if ((((_local2 == 0)) || ((_local3 == 0)))){
                throw (new Error("neither rows nor columns can be zero"));
            };
            var _local6:Insets = _arg1.getInsets();
            var _local7:int = _arg1.getComponentCount();
            if (_local7 == 0){
                return;
            };
            var _local8:GridList = GridCellHolder(_arg1).getList();
            var _local9:int = Math.ceil((_local7 / (_local3 * _local2)));
            var _local10:int = getTileWidth();
            var _local11:int = getTileHeight();
            var _local12:int = _local6.left;
            var _local13:int = _local6.top;
            var _local14:int;
            while (_local14 < _local9) {
                _local13 = _local6.top;
                _local15 = 0;
                while (_local15 < _local3) {
                    _local12 = (_local6.left + ((_local14 * _local2) * (_local10 + _local4)));
                    _local16 = 0;
                    while (_local16 < _local2) {
                        _local17 = ((((_local14 * _local3) * _local2) + (_local15 * _local2)) + _local16);
                        if (_local17 < _local7){
                            _arg1.getComponent(_local17).setBounds(new IntRectangle(_local12, _local13, _local10, _local11));
                            _local8.getCellByIndex(_local17).setGridListCellStatus(_local8, _local8.isSelectedIndex(_local17), _local17);
                        } else {
                            return;
                        };
                        _local12 = (_local12 + (_local10 + _local4));
                        _local16++;
                    };
                    _local13 = (_local13 + (_local11 + _local5));
                    _local15++;
                };
                _local14++;
            };
        }

    }
}//package Display.aswingui 
